package bean;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;

import psc.model.base.cliente.Limite;
import util.ErroEasyBank;
import facade.FacadeConta;
import facade.FacadeLimite;

@ManagedBean
@SessionScoped
public class LimiteBean {

	public LimiteBean() {
		limite = new Limite();
		facadeLimite = new FacadeLimite();
	}

	private Limite limite;
	private FacadeLimite facadeLimite;

	public Limite getLimite() {
		return limite;
	}

	public void setLimite(Limite limite) {
		this.limite = limite;
	}

	public FacadeLimite getFacadeLimite() {
		return facadeLimite;
	}

	public void setFacadeLimite(FacadeLimite facadeLimite) {
		this.facadeLimite = facadeLimite;
	}

	public void gravarLimite() {
		try {
			limite.setConta(new FacadeConta().consultarConta(limite.getConta()));
			this.facadeLimite.adicionarLimiteEspecial(limite);

		} catch (ErroEasyBank e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
}
